# 5
# 7
# 17
# 1
# 1
# 14
n=5
dp=[[0 for _ in range(n)] for _ in range(n)]
print(dp)
i=1
while i<=n:
    m=1
    while m<=i:
        if m==i or m==1:
            dp[i-1][m-1]=1
        elif m>i or m<=0:
            dp[i-1][m-1]=0
        else:
            dp[i-1][m-1]=(m)*dp[i-2][m-1]+dp[i-2][m-2]
        m+=1
    i+=1
sum1=0
print(dp)
for i in range(n):
    sum1+=dp[n-1][i]
print(sum1)

